package com.whfp.coky.api.interceptor

import com.whfp.coky.utils.LogUtil
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response

/**
 *
 *
 * created by coky on 2022/3/2
 */
class TokenInterceptor(var token:String) : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request: Request = chain.request()
            .newBuilder()
            .addHeader("Authorization",
                "Bearer $token")
            .build()
        LogUtil.e("request:" + request.toString())
        LogUtil.e("request headers:" + request.headers().toString())
        return chain.proceed(request)
    }

}